package edu.fiu.cis.personalize.client;

import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;

public class WelcomeBar extends Composite {

	public WelcomeBar(String name, String logoutHref, String helpHref) {
		HorizontalPanel panel = new HorizontalPanel();
		panel.setStylePrimaryName("welcome-panel");
		panel.setSpacing(5);
		panel.setWidth("750px");
		panel.setHeight("20px");

		if (name != null) {
			HTML welcomebanner = new HTML("&nbsp;Logged in as: <b>" + name + "</b>&nbsp;");
			Anchor logoutLink = new Anchor("<b>logout</b>", true);
			Anchor helpLink = new Anchor("help", true, helpHref);
			helpLink.setTarget("blank");
			panel.add(welcomebanner);
			welcomebanner.setWidth("680px");
			welcomebanner.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);
			panel.add(logoutLink);
			panel.add(helpLink);
		}

		initWidget(panel);
	}
}
